#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

/**
 * 定义Student类型，包含数据成员包括姓名、学号、年龄，并用该类型创建不同的对象
*/
class Student{
private:
    int _sno;
    int _age;
    char *_name;

public:
    Student(int sno, int age, const char *name):_sno(sno), _age(age), _name(new char[strlen(name) + 1]){
        strcpy(_name, name);
    }
    void toString(){
        cout << _sno << endl;
        cout << _age << endl;
        cout << _name << endl;
    }
};

int main(void){
    Student s1(1, 18, "Tom");
    Student s2(2, 18, "Jack");

    s1.toString();
    s2.toString(); 
}